

import time
import op_route 
import keti4_config as config

def recv_data(port=16536):
    """
    启动阻塞，监听 16536 端口，并更新全局变量 links
    """
    router_client = op_route.RouterClient(host='localhost', port=16536)

    package_data = router_client.receive_packet()

    return package_data


if __name__ == "__main__":

    reecv_data = recv_data(config.recv_port)
    # 把接收到的数据写到文件中
    with open("recv_data.png", "w") as f:
        f.write(reecv_data)
        print("接收到的数据写到文件中")

    while(True):
        time.sleep(1)
    

